﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Office.Interop.Excel;
using ObjectModel.Excel;


namespace Tests
{
	[TestClass]
	public class UnitTest1
	{
		[TestMethod]
		public void TestMethod1()
		{
		}

		[TestMethod]
		public void Test() {
			
			Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
			app.Visible = true;
			
			
			Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(@"F:\CE Tracker_Mobile_FR_Tables_12-2010_Dec_FINAL.csv");
			Microsoft.Office.Interop.Excel.Worksheet ws = wb.ActiveSheet;

			LinkedRange linkedRange = new LinkedRange(ws.Range["A1"]);

			LookUpStepRange lr = new LookUpStepRange();
			lr.Application = ws.Application;

			lr.Range = ws.Range["A1"];
			lr.Height = 3;
			lr.Width = 3;
			lr.GlobalRowOffset = 1;
			lr.GlobalColOffset = 2;
			lr.RowLookUpSteps.Add( new LookUpStep() { LookUpString = "A2.*", ColAbs = 1 });
			lr.RowLookUpSteps.Add( new LookUpStep() { LookUpString = "Mean*", ColRelOffset = 0, LookUpSetting = LookUpBy.Col });

			lr.ColLookUpSteps.Add( new LookUpStep() { LookUpString = "A2.*", ColAbs = 1, LookUpSetting = LookUpBy.Col});
			lr.ColLookUpSteps.Add( new LookUpStep() { LookUpString = "mobile supplier*total", LookUpSetting = LookUpBy.Both} );

			Range rng = lr.Range;

			Console.WriteLine(rng.Address);
			Console.ReadLine();

			Assert.IsTrue(rng != null, "Range should not be null");
		}
	}
}
